import cinemaView from '../views/cinema.art'
import cinemaModel from '../models/cinema'

class Cinema{
    constructor(){
        this.list = [];
    }
    renderer(list){
        
        let cinemaListHtml = cinemaView({
            list
        })

        $('main').html(cinemaListHtml)
    }

    async render(){

        let result = await cinemaModel.get({
            cityId : localStorage.getItem('cityId') ||('1')
        })
        let list = this.list = result.cinemas;
        
        
        this.renderer(
            list
        )
        $('.city').html(localStorage.getItem('cityHistory') || '北京');

        $('.city').on('tap',function(){  //城市路由点击
            location.hash = 'city'

        })

        $('.input').on('tap',function(){
            location.hash = 'search'
        })

    }
    
}

export default new Cinema()